class AddDatetimeStampsToClasses < ActiveRecord::Migration
  def self.up
    # By using "created_at" or "created_on", ActiveRecord stamps these automatically
    # during ActiveRecord#before_create and ActiveRecord#before_update callbacks
    add_column :volumes, :created_at, :datetime, :null => false
    add_column :volumes, :updated_at, :datetime, :null => false

    add_column :issues, :created_at, :datetime, :null => false
    add_column :issues, :updated_at, :datetime, :null => false

    add_column :sections, :created_at, :datetime, :null => false
    add_column :sections, :updated_at, :datetime, :null => false

    add_column :articles, :created_at, :datetime, :null => false
    add_column :articles, :updated_at, :datetime, :null => false

    remove_column :articles, :article_date

  end

  def self.down
    remove_column :volume, :created_at
    remove_column :volume, :updated_at

    remove_column :issues, :created_at
    remove_column :issues, :updated_at

    remove_column :sections, :created_at
    remove_column :sections, :updated_at

    remove_column :articles, :created_at
    remove_column :articles, :updated_at

    add_column :articles, :article_date, :datetime, :null=>false
  end
end
